Agent Flow Logic
Agent Flow Logic is a native workflow capability for building sophisticated, end‑to‑end agent execution flows tailored to your specific use case. With Agent Flow Logic steps, you can:
- Model complex decision trees that route user queries to the right sub‑agents or tools
- Branch dynamically based on input content, metadata, or intermediate results
- Parallelize work to speed up multi‑step operations
- Use Human approvals to involve human in the agent execution loop
This powerful feature set allows developers to encapsulate business logic, error handling, and context management directly within the agent configuration—no external orchestration required.
Agent Router Step
The Agent Router is the core of Agent Flow Logic. It evaluates incoming requests and determines which route or routes to execute, using an “agentic” LLM‑driven decision step. The router sends descriptions of each available route (including purpose, input/output specs, and any metadata) along with the user’s query to the LLM, which then selects:
- A single best‑fit route
- Multiple concurrent routes when the query matches more than one handler
How It Works
-
Define Routes and Select a LLM
- Give each route a clear description.
- Optionally set a default route (see below).
-
LLM Decision
- On each invocation, the router prompts the LLM with:
- The user’s input
- Descriptions of each route
- (If enabled) Recent chat history
- The LLM replies with one or more route identifiers.
- On each invocation, the router prompts the LLM with:
-
Dispatch
- The system invokes the selected route(s), passing along any extracted parameters and context.
- Route results are collected and returned to the user (or fed into downstream steps).
Single Route Execution
By default, the Agent Router picks only one route per request—the one the LLM deems the best match. This is ideal when:
- You have mutually exclusive handlers (e.g., “Check Weather” vs. “Book Flight”).
- You want a simplified, linear workflow for each user query.
Execute Multiple Routes in Parallel
For scenarios where a query may legitimately touch on more than one domain, you can enable parallel routing. When Execute Multiple Routes is turned on:
- The router can select all routes whose descriptions match the input.
- Each matching route runs simultaneously, reducing end‑to‑end latency.
- Results are merged and returned in a single combined response.
Use parallel routing when your application needs to gather information from multiple sub‑agents in one go (e.g., performing sentiment analysis and topic extraction in the same pass).
Include Chat History
Long‑running conversations often require context to make accurate routing decisions. By enabling Include Chat History, you instruct the router to:
- Pass the last N messages from the conversation along with the routing prompt
- Maintain stateful awareness of user intent across turns
This is especially useful for multi‑step workflows (surveys, booking flows, troubleshooting guides) where the correct handler may depend on prior user responses.
Setting the Default Route
A default route acts as a fallback when:
- The LLM is uncertain which route fits best
- No route descriptions sufficiently match the user’s query
Why and When to Configure
- Graceful Degradation: Ensure users never hit a dead end if the router can’t decide.
- Catch‑All Logic: Implement generic handlers (e.g., “I’m sorry, I didn’t understand that. Can I help with…?”).